<!DOCTYPE html>
<html>
  <head>
    <title>首页</title>
    <link rel='stylesheet' href='/stylesheets/style.css' />
    <link href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">
    <style>
      .pad{
        padding-top: 50px;
      }
    </style>
  </head>
  <body>
    
    <nav class="navbar navbar-inverse navbar-fixed-top">
      <div class="container">
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="/">首页</a>
          <a class="navbar-brand" href="#hot">热映中</a>
          <a class="navbar-brand" href="#coming">即将上映</a>
          <a class="navbar-brand" href="#top">Top250</a>
        </div>
        <div id="navbar" class=" navbar-right">
            <%if(!data.phone){%>
              <a class="navbar-brand" href="/login">登录</a>
              <a class="navbar-brand" href="/register">注册</a>
            <%}else{%>
              <a class="navbar-brand">你好：<%= data.phone %></a>
              <a class="navbar-brand" href="/logout">退出</a>
            <%}%>
        </div>
      </div>
    </nav>
    

    <div id="carousel-example-generic" class="carousel slide" data-ride="carousel">
  <!-- Indicators -->
  <ol class="carousel-indicators">
    <li data-target="#carousel-example-generic" data-slide-to="0" class="active"></li>
    <li data-target="#carousel-example-generic" data-slide-to="1"></li>
    <li data-target="#carousel-example-generic" data-slide-to="2"></li>
    <li data-target="#carousel-example-generic" data-slide-to="3"></li>
    <li data-target="#carousel-example-generic" data-slide-to="4"></li>
  </ol>

  <!-- Wrapper for slides -->
  <div class="carousel-inner" role="listbox" style="height:430px">
    <% data.lunbo.forEach(function(items,index){%>
    <div class="item <% if(index===0){%>active<%}%> ">
      <img src="<%=items.images.large%>" >
      <div class="carousel-caption">
        <h3><%= items.title %></h3>
      </div>
    </div>
    <% })%>
  </div>

  <!-- Controls -->
  <a class="left carousel-control" href="#carousel-example-generic" role="button" data-slide="prev">
    <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
    <span class="sr-only">Previous</span>
  </a>
  <a class="right carousel-control" href="#carousel-example-generic" role="button" data-slide="next">
    <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
    <span class="sr-only">Next</span>
  </a>
</div>  



    <div class="pad"></div>
    <div  class="container" id="hot">
      <h2><a href="/movie/list?collection=in_theaters&pageNo=1">热映中</a></h2>
      <% data.in_theaters.forEach(function(item,index){%>
          <div class="col-sm-2 col-xs-6" style="height:180px">
            <a href="/movie/detail?id=<%=item.id%>" class="item" target="_self">
              <div class="img-outer">
                <div class="img-inner">
                  <img class="card-img lazy" data-original="/Public/img/apollo.jpg" alt="Card image" src="<%=item.images.medium%>" style="display: inline;">
                  <div class="card-img-bottomlay">
                    <%= item.title %> 
                  </div>
                </div>
              </div>
            </a>
          </div>
        <% })%>
    </div>
    <div class="pad"></div>
    <div  class="container" id="coming">
        <h2><a href="/movie/list?collection=coming_soon&pageNo=1">即将上映</h2>
         <% data.coming_soon.forEach(function(items,index){%>
          <div class="col-sm-2 col-xs-6" style="height:180px">
            <a href="##" class="item" target="_self">
              <div class="img-outer">
                <div class="img-inner">
                  <img class="card-img lazy" data-original="/Public/img/apollo.jpg" alt="Card image" src="<%=items.images.medium%>" style="display: inline;">
                  <div class="card-img-bottomlay">
                    <%= items.title %> 
                  </div>
                </div>
              </div>
            </a>
          </div>
        <% })%>
    </div>
    <div class="pad"></div>

    <div  class="container" id="top">
        <h2><a href="/movie/list?collection=top250&pageNo=1">TOP250</h2>
         <% data.top250.forEach(function(items,index){%>
          <div class="col-sm-2 col-xs-6" style="height:180px">
            <a href="##" class="item" target="_self">
              <div class="img-outer">
                <div class="img-inner">
                  <img class="card-img lazy" data-original="/Public/img/apollo.jpg" alt="Card image" src="<%=items.images.medium%>" style="display: inline;">
                  <div class="card-img-bottomlay">
                    <%= items.title %> 
                  </div>
                </div>
              </div>
            </a>
          </div>
        <% })%>
    </div>
        <script src="https://cdn.bootcss.com/jquery/1.12.4/jquery.min.js"></script>
        <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
  </body>
</html>
